/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fserv;

import fserv.control.ServerController;
import fserv.model.ServerData;
import fserv.ni.NetworkInterface;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author arthur
 */
public class Server {

    public static void main(String[] args) {
        try {
            /* Configure the Network Interface (required if multiple network
            interfaces are available) */
            NetworkInterface.setRemoteAddr(InetAddress.getByName("127.0.0.1"));
            NetworkInterface.setPort(NetworkInterface.ServerPORT);
            String homeDir = System.getProperty("user.home");
            ServerData.setDataDir(homeDir + System.getProperty("file.separator")+"fserv");

            // Initialize the Controller, the Network Interface and the GUI
            ServerController ctrl = ServerController.getInstance();
            NetworkInterface ni = NetworkInterface.getInstance();
            ServerData.getInstance();

            // Set up the associations
            ctrl.setNI(ni);
            ni.setCtrl(ctrl);
            ni.run();
        } catch (UnknownHostException ex) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    	
}
